﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AG.Data
{
    public class AGModel
    {
        /// <summary>
        /// 模型的真实编号
        /// </summary>
        public ushort Id { get; set; }
        public string Caption { get; set; }
        public ushort CategoryId { get; set; }
        public List<AGModelAction> Actions { get; private set; }
        public AGModel()
        {
            Actions = new List<AGModelAction>();
        }

        public AGModelAction GetAction(byte actionId)
        {
            for (int index = 0; index < Actions.Count; index++)
            {
                if (Actions[index].Id == actionId)
                {
                    return Actions[index];
                }
            }
            return null;
        }

        public override string ToString()
        {
            return string.Format("[{0:d4}]{1}", Id, Caption);
        }
    }
}
